#include<bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 7;
int a[MAXN];
int b[MAXN];
int c[MAXN];
int dp1[MAXN];
int dp2[MAXN];
int dp3[MAXN];
int main(){
	int n;
	cin >> n;
	for(int i = 1;i <= n;i++){
		cin >> a[i] >> b[i] >> c[i];
	}
	for(int i = 1;i <= n;i++){
		dp1[i] = max(dp2[i - 1],dp3[i - 1]) + a[i];
		dp2[i] = max(dp1[i - 1],dp3[i - 1]) + b[i];
		dp3[i] = max(dp1[i - 1],dp2[i - 1]) + c[i];
	}
	cout << max(max(dp1[n],dp2[n]),dp3[n]) << "\n";
}